package cn.zhouchao.fallback;

import cn.zhouchao.domain.User;
import cn.zhouchao.feigen.UserService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserServiceFallbackFactory implements FallbackFactory<UserService> {
    @Override
    public UserService create(Throwable throwable) {
        return new UserService() {
            @Override
            public User getUser(Long id) {
                return new User(-1L, "熔断了", "断了断了，哼！！！！");
            }
        };
    }
}
